﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace HFUTCourseSimulation.Widget {
    /// <summary>
    /// Interaction logic for LogChecker.xaml
    /// </summary>
    public partial class LogChecker : Window {
        public LogChecker() {
            InitializeComponent();
        }

        private void uiMainWindow_Loaded(object sender, RoutedEventArgs e) {
            var hasError = CurrentReporter.HasError();
            uiErrorBanner.Visibility = hasError ? Visibility.Visible : Visibility.Collapsed;
            uiOkBanner.Visibility = hasError ? Visibility.Collapsed : Visibility.Visible;
            uiMessageList.ItemsSource = CurrentReporter;
        }

        private void uiMainWindow_Closed(object sender, EventArgs e) {
            uiMessageList.ItemsSource = null;
        }

        public Kernel.Reporter CurrentReporter { get; set; }

        private void uiBtnOk_Click(object sender, RoutedEventArgs e) {
            this.Close();
        }
    }
}
